package cn.itcast.nems.journal.dto;

import java.util.Map;

import cn.itcast.nems.studentrecord.dao.entity.JournalTransferType;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class AllJournalTransferReasonVDTO {
    private Map<JournalTransferType, Map<String, JournalTransferReasonVDTO>> journalType;

    public JournalTransferReasonVDTO getByTypeAndCode(JournalTransferType type, String code) {
        var map = journalType.get(type);
        if (map == null) {
            return null;
        }
        return map.get(code);
    }
    
    public JournalTransferReasonVDTO getByTypeAndName(JournalTransferType type, String name) {
        var map = journalType.get(type);
        if (map == null) {
            return null;
        }
        return map.get(name);
    }
}
